package com.ruoyi.mdm.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.mdm.mapper.WeightRuleMapper;
import com.ruoyi.mdm.domain.WeightRule;
import com.ruoyi.mdm.service.IWeightRuleService;

/**
 * 权重规则Service业务层处理
 *
 * @author shiseido
 * @date 2025-02-28
 */
@Service
public class WeightRuleServiceImpl implements IWeightRuleService {
    @Autowired
    private WeightRuleMapper weightRuleMapper;

    /**
     * 查询权重规则
     *
     * @param id 权重规则主键
     * @return 权重规则
     */
    @Override
    public WeightRule selectWeightRuleById(Long id) {
        return weightRuleMapper.selectWeightRuleById(id);
    }

    /**
     * 查询权重规则列表
     *
     * @param weightRule 权重规则
     * @return 权重规则
     */
    @Override
    public List<WeightRule> selectWeightRuleList(WeightRule weightRule) {
        return weightRuleMapper.selectWeightRuleList(weightRule);
    }

    /**
     * 新增权重规则
     *
     * @param weightRule 权重规则
     * @return 结果
     */
    @Override
    public int insertWeightRule(WeightRule weightRule) {
        weightRule.setCreateTime(DateUtils.getNowDate());
        return weightRuleMapper.insertWeightRule(weightRule);
    }

    /**
     * 修改权重规则
     *
     * @param weightRule 权重规则
     * @return 结果
     */
    @Override
    public int updateWeightRule(WeightRule weightRule) {
        weightRule.setUpdateTime(DateUtils.getNowDate());
        return weightRuleMapper.updateWeightRule(weightRule);
    }

    /**
     * 批量删除权重规则
     *
     * @param ids 需要删除的权重规则主键
     * @return 结果
     */
    @Override
    public int deleteWeightRuleByIds(Long[] ids) {
        return weightRuleMapper.deleteWeightRuleByIds(ids);
    }

    /**
     * 删除权重规则信息
     *
     * @param id 权重规则主键
     * @return 结果
     */
    @Override
    public int deleteWeightRuleById(Long id) {
        return weightRuleMapper.deleteWeightRuleById(id);
    }
}
